<template>
  <div class="_nav">
    <div class="title_nav" :class="isFontCo ? 'title_navtwo' : ''">
      <div class="iconfont iconfanhui4" v-show="isArrow" @click="goBack"></div>
      <div class="title_name" :class="isFontCo ? 'title_nametwo' : ''">{{ title }}</div>
      <span></span>
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()
const props = defineProps({
  title: {
    type: String
  },
  isFontCo: {
    type: Boolean
  },
  isArrow: {
    type: Boolean,
    default: true
  },
  backFn: {
    type: Function,
    default: () => null
  }
})
const goBack = () => {
  if (props.backFn) {
    props.backFn()
  }
  router.go(-1)
}
</script>
<style scoped lang="scss">
._nav {
  position: relative;
  height: 48px;
  .title_nav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    background: #61a4ff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .iconfanhui4 {
      font-size: 28px;
    }
    .title_name {
      font-size: 19px;
      font-weight: 500;
      text-align: center;
      color: #ffffff;
      line-height: 19px;
    }
    .title_nametwo {
      color: #333 !important;
    }
    span {
      width: 28px;
    }
  }
  .title_navtwo {
    background: #fff !important;
    color: #333 !important;
  }
}
</style>